<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCellsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cells', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('project_id')->comment('项目ID');
            $table->unsignedBigInteger('column_id')->comment('列ID');
            $table->unsignedBigInteger('row_id')->comment('行ID');
            $table->string('type')->default('text')->comment('内容类型');
            $table->text('content')->comment('内容');
            $table->timestamps();

            $table->index('project_id');
            $table->index('column_id');
            $table->index('row_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cells');
    }
}
